package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.BannerDaoImpl;
import com.ysd.dao.impl.CompanyDaoImpl;
import com.ysd.entity.Banner;
import com.ysd.entity.Company;

public class HeadServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 公司信息
		CompanyDaoImpl cDao = new CompanyDaoImpl();
		Company c = cDao.getCompany();
		request.setAttribute("c", c);
		
		// 轮播图
		BannerDaoImpl bDao = new BannerDaoImpl();
		List<Banner> bannerList = bDao.getBannerList();
		request.setAttribute("bannerList", bannerList);
		
		request.getRequestDispatcher("head.jsp").include(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
